<template>
    <h1>{{subjectInfo.subjectName}}</h1>
</template>

<script>
export default {
    data(){
        return{
            subjectInfo:null
        }
    },
    mounted() {
        this.getSubjectInfo()
    },
    methods: {
        getSubjectInfo(){
            this.$http({
                methods: 'get',
                url: "subject/findId",
                params:{
                    "id":this.$route.params.id
                },
                headers:{
                    "token":window.localStorage.getItem("token")
                }
            }).then(res=>{
                if(res.data.code==5){
                    this.$message.error("登录信息有误");
                    this.$router.push("/login");
                }
                else if(res.data.code==0){
                    this.subjectInfo = res.data.data
                }
                else{
                    this.$message.error("id不存在");
                }
            })
        }
    },
}
</script>

<style long="less" scoped>

</style>
